﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;

namespace CTManagerSoln
{
    public class clsKiemDuyet
    {
        internal static int inSert(string sohieuChungTu, string nguoichuyen, string tuphongban, string nguoinhan, DateTime ngaychuyen, DateTime ngaykiemduyet, string ghichu, bool isApprove)
        {
            int stateUpdate;
            string sql = "INSERT into tblKiemDuyet (SoHieuChungTu,NguoiChuyen,TuPhongBan,NguoiNhan,NgayChuyen,NgayKiemDuyet,GhiChu,isAprove) "
            + " Values(@SoHieuChungTu,@nguoichuyen,@tuphongban,@nguoinhan,@ngaychuyen,@ngaykiemduyet,@ghichu,@isapprove)";

            using (OleDbConnection conn = new OleDbConnection(Commons.DBConnect.ConnectionString))
            {
                using (OleDbCommand command = new OleDbCommand(sql, conn))
                {
                    conn.Open();
                    command.Parameters.Add("@SoHieuChungTu", OleDbType.VarChar).Value = sohieuChungTu;
                    command.Parameters.Add("@nguoichuyen", OleDbType.VarChar).Value = nguoichuyen;
                    command.Parameters.Add("@tuphongban", OleDbType.VarChar).Value = tuphongban;
                    command.Parameters.Add("@nguoinhan", OleDbType.VarChar).Value = nguoinhan;
                    command.Parameters.Add("@ngaychuyen", OleDbType.Date).Value = ngaychuyen;
                    command.Parameters.Add("@ngaykiemduyet", OleDbType.Date).Value = ngaykiemduyet;
                    command.Parameters.Add("@ghichu", OleDbType.VarChar).Value = ghichu;
                    command.Parameters.Add("@isapprove", OleDbType.Boolean).Value = isApprove;


                  stateUpdate=  command.ExecuteNonQuery();
                }
            }
            return stateUpdate;
        }
    }
}
